#pragma once

#include "njm_ecs.hpp"

#include "njm_window.hpp"
#include "njm_device.hpp"
#include "njm_renderer.hpp"
#include "njm_descriptor.hpp"

#include "njm_model.hpp"
#include "njm_img.hpp"
#include "njm_texture.hpp"

#include <memory>
#include <vector>

namespace njm
{
    class ECSApp
    {
    public:
        static constexpr int WIDTH = 800;
        static constexpr int HEIGHT = 800;
        static constexpr float MAX_FRAME_TIME = 0.05f; // 50ms

        ECSApp();
        ~ECSApp();
        ECSApp(const ECSApp &) = delete;
        ECSApp &operator=(const ECSApp &) = delete;

        void init();
        void run();

    private:
        std::unique_ptr<Coordinator> mCoordinator;
        NjmWindow njmWindow{WIDTH, HEIGHT, "ECS APP"};
        NjmDevice njmDevice{njmWindow};
        NjmRenderer njmRenderer{njmWindow, njmDevice};
        std::unique_ptr<NjmDescriptorPool> globalPool{};

        std::vector<NjmImg::id_t> imgIds;
        std::vector<NjmTexture::id_t> texIds;
        NjmImg::Map njmImgs;
        NjmModel::Map njmModels;

        void loadImgs();
        void loadModels();
        void printAssetsInfo();
    };
}
